FROM onlyoffice/documentserver:9.1.0.1

ENV ALLOW_PRIVATE_IP_ADDRESS=true
ENV ALLOW_META_IP_ADDRESS=true
ENV PLUGINS_ENABLED=false 
ENV JWT_ENABLED=false
RUN rm -rf /var/www/onlyoffice/documentserver/sdkjs-plugins/marketplace
COPY ./public/myfonts/ /usr/share/fonts/truetype/custom/

# COPY ./replace-files/var /var
RUN sed -i 's#"DE.ApplicationController.textOf": "的"#"DE.ApplicationController.textOf": "/"#g' /var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/embed/locale/zh.json
RUN sed -i 's#"PE.ApplicationController.textOf": "的"#"PE.ApplicationController.textOf": "/"#g' /var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/embed/locale/zh.json

RUN echo 'echo '\''$("#header-logo")?.addClass("hidden");'\'' >> /var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/embed/app-all.js' >> /usr/bin/documentserver-static-gzip.sh

# RUN /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/default.json -I -e 'this.services.CoAuthoring.plugins.autostart.push("asc.{0616AE85-5DBE-4B6B-A0A9-455C4F1503A1}")' 
COPY ./public/oo-plugins/execanycommand /var/www/onlyoffice/documentserver/sdkjs-plugins/execanycommand

# docker build . -t registry.choerodon.com.cn/hzero-fe-public/onlyoffice:latest
# docker rm -f onlyoffice
# docker run --name onlyoffice -i -t -d -p 80:80 -v /mnt/d/data/oo:/var/www/onlyoffice/documentserver/web-apps/wsData --env JWT_SECRET=VI71S3cGtXg96HgFWzQhblz1KwMc1Jzk -e JWT_ENABLED=false --env ALLOW_PRIVATE_IP_ADDRESS=true --env ALLOW_META_IP_ADDRESS=true --env PLUGINS_ENABLED=false registry.choerodon.com.cn/hzero-fe-public/onlyoffice:latest
# docker exec -ti onlyoffice sudo supervisorctl start ds:example
# docker run -ti --rm registry.choerodon.com.cn/hzero-fe-public/onlyoffice:latest bash
